home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3650 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.7 KB

  1. Path: news.eunet.fi!fipnet!kone!jsaarinen
  2. Newsgroups: comp.sys.amiga.programmer
  3. X-NewsReader: IntuiNews 1.2b (31.7.94)
  4. References: <38232459@kone.fipnet.fi> <4gbb5a$104@sunsystem5.informatik.tu-muenchen.de> <312990E8.5622@si.hhs.nl>
  5. From: "Jyrki Saarinen" <jsaarinen@kone.fipnet.fi>
  6. Date: Thu, 22 Feb 96 18:15:25 UT
  7. Comments: Illegal date header - new date added by quicknews
  8. X-Original-Date: Thu, 22 Feb 96 19:24:37 
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: binary
  12. Subject: Re: TMapping again!
  13. Message-ID: <38232606@kone.fipnet.fi>
  14.  
  15.  
  16. > Alas, there is only one solution: use an extra register. Here is my
  17. > version, (in which I choose to use a4) _with_ pipe-line optimalization:
  18. >  
  19. >         move.w  d1,d2  ; Set y-position texture (fixed-point 16.8)
  20. >         addx.l  d4,d1  ; ..and increase.
  21. >         move.b  d0,d2  ; Set x-position texture (fixed-point 16.16)
  22. >         addx.l  d3,d0  ; ..and increase.
  23. >         move.w  d2,a0  ; Create texture-pointer.
  24. >         move.l  a2,d2  ; Get shading-table pointer (fixed-point adres). 
  25. >       
  26. >     ; only stall happens here (another write to d2):
  27. >         move.b  (a0),d2  ; Get texel; use as index into shading table.
  28. >         adda.l  a3,a2  ; Increase shading pointer (fixed-point adres).
  29. >         move.l  d2,a4  ; Create shading-pointer.
  30. >         move.b  (a4),(a1)+  ; Write shaded texel to screen.
  31.  
  32. At least on the 68040 is it very important to have a instruction
  33. between
  34.         move.l  d2,a4
  35.         move.b  (a4),(a1)+
  36.  
  37. I got a ~20% speed increase when I pipelined the loop
  38. like this:
  39.  
  40. poly    REPT    16
  41.     move.w    d3,d0
  42.     move.w    a1,d1
  43.     move.b    d4,d0
  44.     addx.l    d5,d3
  45.     move.l    d0,a3
  46.     addx.l    d6,d4
  47.     move.b    (a3),d1
  48. Here is the only stall
  49.     move.l    d1,a3
  50.     add.l    a2,a1
  51.     move.b    (a3),(a0)+
  52.     ENDR
  53.  
  54. Strangely enough, a different kind of scheduled loop
  55. delivered the best results on a 68060!
  56.  
  57. >         move.w  d1,d2      ; Set y-position texture.
  58. >         addx.l  d4,d1      ; Increase y-position.
  59. >         move.b  d0,d2      ; Set x-position texture.
  60. >         move.l  a2,d5      ; Create a copy of the shading-table pointer.
  61. >         addx.l  d3,d0      ; Increase x-position.
  62. >         move.b  (d2),d5    ; Get texel; use as index into shading table.
  63. >         adda.l  a3,a2      ; Increase shading pointer.
  64. >         move.b  (d5),(a1)+ ; Write shaded texel to screen.
  65. >  
  66. > ...shorter program (instruction _and_ byte-wise), faster execution,
  67. > less register-usage, no pipe-line stalls...
  68. > (Note the "(dX)", this one should execute just as fast as an "(aX)",
  69. > right?)
  70.  
  71. Have you actually tested..? ;) (dn) is VERY slow.
  72.  
  73. > F E E D B A C K !   :)
  74.  
  75. You got it..
  76.  
  77. --                               _
  78. a Stellar programmer          _ //
  79. "Amiga - back for the future" \X/
  80.